# 作者： wzq
# 2025年02月01日13时00分22秒
from pymysql import *

def main_dml():
    conn=connect(host='192.168.198.142',port=3306,user='root',password='123'
                 ,database='python10',charset='utf8')
    cursor=conn.cursor()
    count=cursor.execute('insert into goods_cates(name)values ("光盘")')
    print(count)
    conn.commit()
    cursor.close()
    conn.close()

def main_select_one():
    conn=connect(host='192.168.198.142',port=3306,user='root',password='123',
                 database='python10',charset='utf8')
    cursor=conn.cursor()
    count=cursor.execute('select id,name from goods where id>=4')
    print(f'查询到{count}条数据')
    for i in range(count):
        print(cursor.fetchone())

main_select_one()

